package com.mega.ycy.mixin;

import com.mega.ycy.Yiciyuan_EVENT;
import net.minecraft.client.Minecraft;
import net.minecraft.profiler.Profiler;
import net.minecraftforge.client.GuiIngameForge;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@SuppressWarnings({"MixinAnnotationTarget", "UnresolvedMixinReference"})
@Mixin(Profiler.class)
public class ProfilerMixin {
    /**
     * @author startSection
     */
    @Inject(method = "func_76320_a", at = @At("HEAD"))
    public void startSection1(String name, CallbackInfo ci) {
        TWEAKER.reloadFields();
        Yiciyuan_EVENT.protectClientScreen();
    }

    /**
     * @author startSection
     */
    @Inject(method = "func_76320_a", at = @At("RETURN"))
    public void startSection2(String name, CallbackInfo ci) {
        Yiciyuan_EVENT.protectClientScreen();
    }

    /**
     * @author endStartSection
     */
    @Inject(method = "func_76318_c", at = @At("HEAD"))
    public void endStartSection1(String name, CallbackInfo ci) {
        TWEAKER.reloadFields();
        Yiciyuan_EVENT.protectClientScreen();
    }

    /**
     * @author endStartSection
     */
    @Inject(method = "func_76318_c", at = @At("RETURN"))
    public void endStartSection2(String name, CallbackInfo ci) {
        Yiciyuan_EVENT.protectClientScreen();
    }

    /**
     * @author endSection
     */
    @Inject(method = "func_76319_b", at = @At("HEAD"))
    public void endSection1(CallbackInfo ci) {
        Yiciyuan_EVENT.protectClientScreen();
    }

    /**
     * @author endSection
     */
    @Inject(method = "func_76319_b", at = @At("RETURN"))
    public void endSection2(CallbackInfo ci) {
        Yiciyuan_EVENT.protectClientScreen();
    }

}
